/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biofilter.records;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author qvh
 */
public class GFFRecordTest {

    public GFFRecordTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of parseGFFLine method, of class GFF.
     */
    @Test
    public void testParseGFFLine() {
        System.out.println("parseGFFLine");
        //             0               1       2       3       4       5       6       7       8
        //             seqid           source  type    start   end     score   strand  phase   attributes
        String line = "CP000568        GenBank CDS     104     1723    0       1       .       Locus tag: Cthe_0001;Product: Recombinase;color AA0000;";
        GFFRecord instance = new GFFRecord();
        boolean parseResult = instance.parseGFFLine(line);
        assertEquals(true, parseResult);
        assertEquals("CP000568",instance.getSeqid());
        assertEquals("GenBank",instance.getSource());
        assertEquals("CDS",instance.getType());
        assertEquals(104,instance.getStart());
        assertEquals(1723,instance.getEnd());
        double score = 0.0;
        assertEquals(0.0,instance.getScore(), 0.000001 );
        assertEquals('+',instance.getStrand());
        assertEquals(".", instance.getPhase());
        assertEquals("Locus tag: Cthe_0001;Product: Recombinase;color AA0000;", instance.getAttributes());
    }




    @Test
    public void testParseNGSGFFLine(){
        System.out.println("parseNGSGFFLine");
        //             0        1       2               3       4       5       6       7
        //             seqid    source  type            start   end     score   strand
        String line = "CP000568	NGS	OID21551	1	57	01	.	.";
        GFFRecord instance = new GFFRecord();
        instance.parseGFFLine(line);
        assertEquals("CP000568",instance.getSeqid());
        assertEquals("NGS",instance.getSource());
        assertEquals("OID21551",instance.getType());
        assertEquals(1,instance.getStart());
        assertEquals(57,instance.getEnd());
        double score = 1.0;
        assertEquals(1,instance.getScore(), 0.000001 );
        assertEquals('.',instance.getStrand());
        assertEquals(".", instance.getPhase());
    }

    @Test
    public void testSteveBrownOct31_2009MaryProbesToAnno(){
        System.out.println("steveBrownOct31_2009MaryProbesToAnno");
        String annoFile = "/Users/qvh/steve/annotation.gff";
        String probeFile = "/Users/qvh/steve/OID21551_probes.gff";
        String outFile = "/Users/qvh/steve/test.gff";
        GFFRecord gffParser = new GFFRecord();
        //gffParser.steveBrownOct31_2009MaryProbesToAnno(probeFile, annoFile, outFile);
    }

}